package com.cxxx.guns.modular.portal.controller;
//
//                       _oo0oo_
//                      o8888888o
//                      88" . "88
//                      (| -_- |)
//                      0\  =  /0
//                    ___/`---'\___
//                  .' \\|     |// '.
//                 / \\|||  :  |||// \
//                / _||||| -:- |||||- \
//               |   | \\\  -  /// |   |
//               | \_|  ''\---/''  |_/ |
//               \  .-\__  '-'  ___/-. /
//             ___'. .'  /--.--\  `. .'___
//          ."" '<  `.___\_<|>_/___.' >' "".
//         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//         \  \ `_.   \_ __\ /__ _/   .-` /  /
//     =====`-.____`.___ \_____/___.-`___.-'=====
//                       `=---='
//
//
//     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//               佛祖保佑         永无BUG
//

import com.cxxx.guns.modular.backend.model.Message;
import com.cxxx.guns.modular.backend.service.IMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author: yyi
 * @date: 2018/9/18 16:09
 * @parameters:
 * @desc:
 **/
@Controller
@RequestMapping(value = "/portal")
public class MsgController {
    @Autowired
    private IMessageService messageService;
    @RequestMapping(value = "/addmsg",method =RequestMethod.GET)
    @ResponseBody
    public String add(@RequestParam("username") String username,@RequestParam("tel") String tel,@RequestParam("message") String message){
        Message msg = new Message();
        msg.setMessage(message);
        /*1为留言，2是送教上门*/
        msg.setModel(1);
        msg.setTelemail(tel);
        msg.setMessage(message);
        messageService.insert(msg);
        return "SUCCESS";


    }
}
